//
//  UIImageView+WebImage.m
//  BaseDemo
//
//  Created by 付凡 on 2017/11/21.
//  Copyright © 2017年 付凡. All rights reserved.
//

#import "UIImageView+WebImage.h"

@implementation UIImageView (WebImage)

/// 隔离SDWebImage 设置头像
///
/// - Parameters:
///   - urlString: 图片路径
///   - placeholderImage: 占位图像
///   - isAvatar: 是否圆角
-(void)xj_setImage:(NSString *)urlString placeholderImage:(UIImage *)placeholderImage isAvatar:(BOOL)isAvatar{
    //处理URL
    [self sd_setImageWithURL:IMAGEURL(urlString) placeholderImage:placeholderImage completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
        //完成回调
      
        if (isAvatar && (image != nil)) {
            self.image =   [image avaterImageWithImage:image size:self.bounds.size backColor:[UIColor clearColor]];
        }
    }];
}


@end
